<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <!-- css -->
    <link th:href="@{/css/bootstrap.min.css}" href="../static/css/bootstrap.min.css" rel="stylesheet"/>
    <link th:href="@{/css/font-awesome.min.css}" href="../static/css/font-awesome.min.css" rel="stylesheet">
    <link th:href="@{/css/nprogress.css}" href="../static/css/nprogress.css" rel="stylesheet">
    <link th:href="@{/css/green.css}" href="../static/css/green.css" rel="stylesheet">
    <link th:href="@{/css/bootstrap-progressbar-3.3.4.min.css}" href="../static/css/bootstrap-progressbar-3.3.4.min.css"
          rel="stylesheet">
    <link th:href="@{/css/jqvmap.min.css}" href="../static/css/jqvmap.min.css" rel="stylesheet"/>
    <link th:href="@{/css/dropzone.min.css}" href="../static/css/dropzone.min.css" rel="stylesheet">
    <link th:href="@{/css/custom.min.css}" href="../static/css/custom.min.css" rel="stylesheet">
    <!--js -->
    <script th:src="@{/js/jquery.min.js}" src="../static/js/jquery.min.js"></script>
    <script th:src="@{/js/bootstrap.min.js}" src="../static/js/bootstrap.min.js"></script>
    <script th:src="@{/js/fastclick.js}" src="../static/js/fastclick.js"></script>
    <script th:src="@{/js/nprogress.js}" src="../static/js/nprogress.js"></script>
    <script th:src="@{/js/jquery.mCustomScrollbar.concat.min.js}"
            src="../static/js/jquery.mCustomScrollbar.concat.min.js"></script>
    <script th:src="@{/js/dropzone.js}" src="../static/js/dropzone.js"></script>
    <script th:src="@{/js/custom.min.js}" src="../static/js/custom.min.js"></script>
    <script th:src="@{/localjs/rollpage.js}" src="../static/localjs/rollpage.js"></script>

<!--    &lt;!&ndash; 引入样式 &ndash;&gt;-->
<!--    <link rel="stylesheet" href="https://unpkg.com/element-plus/lib/theme-chalk/index.css">-->
<!--    &lt;!&ndash; 引入组件库 &ndash;&gt;-->
<!--    <script src="https://unpkg.com/element-plus/lib/index.full.js"></script>-->

</head>
<body class="login">
<div>
    <a class="hiddenanchor" id="signup"></a>
    <a class="hiddenanchor" id="signin"></a>

    <div class="login_wrapper">
        <div class="animate form login_form">
            <section class="login_content">
                <form action="" th:action="@{/doLogin}" method="post">
                    <h1>欢迎登陆</h1>
                    <div>
                        <span id="mse" style="color: #ff0000"></span>
                    </div>
                    <div>
                        <input type="text" class="form-control" name="name" placeholder="用户名"
                               value="admin" required=""/>
                    </div>
                    <div>
                        <input type="password" class="form-control" name="pwd" placeholder="密码"
                               value="0000" required=""/>
                    </div>
                    <div>
                        <button type="button" onclick="sun()" class="btn btn-success">登 录</button>
                        <button type="reset" class="btn btn-default">重 置</button>
                    </div>

                    <div class="clearfix"></div>

                    <div class="separator">
                        <div class="clearfix"></div>
                        <br/>

                        <div>
                            <p>©2019 All Rights Reserved 科泰教育</p>
                        </div>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
<script>
    sun = function () {
        $.ajax({
            url:"/doLogin",
            data:$("form").serialize(),
            datatype: JSON,
            success:function (data) {
                console.log(data)
                if (data.message=="正确"){
                    location.href="/main";
                }else {
                    console.log(data.data.time)
                    let sun = data.data.time;
                    if (data.data.name=="该账号已冻结！"){
                        function ss(){
                            sun=sun-1
                            if (sun<=0){
                                $("#mse").text("已解冻");
                            }else {
                                $("#mse").text(data.data.name+"距解冻时间还有"+sun+"秒");
                            }
                        }
                        setInterval(ss,1000);
                    }else {
                        $("#mse").text(data.data.name);
                    }
                }
            }
        })
    }
</script>
</body>
</html>